//获取所有的表情图片关联信息
const ba = function() {
    var a = {
        "[\u5fae\u7b11]": "2009426204649332.gif",
        "[\u6487\u5634]": "2009426204432159.gif",
        "[\u8272]": "2009426203942933.gif",
        "[\u53d1\u5446]": "2009426203927717.gif",
        "[\u5f97\u610f]": "2009426204332318.gif",
        "[\u6d41\u6cea]": "2009426204655335.gif",
        "[\u5bb3\u7f9e]": "2009426204421181.gif",
        "[\u95ed\u5634]": "2009426203947115.gif",
        "[\u7761]": "200942620473854.gif",
        "[\u5927\u54ed]": "2009426204336398.gif",
        "[\u5c34\u5c2c]": "200942620363243.gif",
        "[\u53d1\u6012]": "2009426204453127.gif",
        "[\u8c03\u76ae]": "2009426203918413.gif",
        "[\u5472\u7259]": "2009426203834799.gif",
        "[\u60ca\u8bb6]": "2009426204438161.gif",
        "[\u96be\u8fc7]": "2009426204457207.gif",
        "[\u9177]": "2009426203631924.gif",
        "[\u51b7\u6c57]": "2009426203826955.gif",
        "[\u6293\u72c2]": "2009426204343825.gif",
        "[\u5410]": "2009426204710696.gif",
        "[\u5077\u7b11]": "2009426203535123.gif",
        "[\u6109\u5feb]": "2009426203845213.gif",
        "[\u767d\u773c]": "2009426204559431.gif",
        "[\u50b2\u6162]": "2009426203626168.gif",
        "[\u9965\u997f]": "200942620382405.gif",
        "[\u56f0]": "2009426204511756.gif",
        "[\u60ca\u6050]": "200942620476841.gif",
        "[\u6d41\u6c57]": "2009426203612485.gif",
        "[\u61a8\u7b11]": "2009426204554209.gif",
        "[\u60a0\u95f2]": "2009426204725241.gif",
        "[\u594b\u6597]": "2009426203552327.gif",
        "[\u5492\u9a82]": "2009426203643426.gif",
        "[\u7591\u95ee]": "2009426204716110.gif",
        "[\u5618]": "2009426204121698.gif",
        "[\u6655]": "2009426203543362.gif",
        "[\u75af\u4e86]": "200942620387292.gif",
        "[\u8870]": "200942620463342.gif",
        "[\u9ab7\u9ac5]": "2009426204614878.gif",
        "[\u6572\u6253]": "2009426204353991.gif",
        "[\u518d\u89c1]": "2009426203520915.gif",
        "[\u64e6\u6c57]": "200942620400917.gif",
        "[\u62a0\u9f3b]": "2009426203524599.gif",
        "[\u9f13\u638c]": "2009426203744593.gif",
        "[\u7cd7\u5927\u4e86]": "2009426204347115.gif",
        "[\u574f\u7b11]": "2009426203640891.gif",
        "[\u5de6\u54fc\u54fc]": "2009426204611216.gif",
        "[\u53f3\u54fc\u54fc]": "2009426203823435.gif",
        "[\u54c8\u6b20]": "2009426204626462.gif",
        "[\u9119\u89c6]": "2009426204413198.gif",
        "[\u59d4\u5c48]": "2009426204519320.gif",
        "[\u5feb\u54ed\u4e86]": "2009426204634617.gif",
        "[\u9634\u9669]": "200942620370827.gif",
        "[\u4eb2\u4eb2]": "2009426204719604.gif",
        "[\u5413]": "2009426204623279.gif",
        "[\u53ef\u601c]": "200942620415695.gif",
        "[\u83dc\u5200]": "2009426203922939.gif",
        "[\u897f\u74dc]": "2009426203856297.gif",
        "[\u5564\u9152]": "2009426204630345.gif",
        "[\u7bee\u7403]": "2009426204326116.gif",
        "[\u4e52\u4e53]": "2009426203723341.gif",
        "[\u5496\u5561]": "2009426204523765.gif",
        "[\u996d]": "2009426203556965.gif",
        "[\u732a\u5934]": "2009426203837308.gif",
        "[\u73ab\u7470]": "2009426203656691.gif",
        "[\u51cb\u8c22]": "2009426204619707.gif",
        "[\u5634\u5507]": "200942620410615.gif",
        "[\u7231\u5fc3]": "2009426203954405.gif",
        "[\u5fc3\u788e]": "2009426203619609.gif",
        "[\u86cb\u7cd5]": "200942620408116.gif",
        "[\u95ea\u7535]": "2009426203647674.gif",
        "[\u70b8\u5f39]": "2009426204329724.gif",
        "[\u5200]": "2009426204551293.gif",
        "[\u8db3\u7403]": "2009426203714788.gif",
        "[\u74e2\u866b]": "2009426203740796.gif",
        "[\u4fbf\u4fbf]": "2009426204731691.gif",
        "[\u6708\u4eae]": "2009426204640960.gif",
        "[\u592a\u9633]": "2009426203720577.gif",
        "[\u793c\u7269]": "2009426203930309.gif",
        "[\u62e5\u62b1]": "2009426204417246.gif",
        "[\u5f3a]": "200942620450530.gif",
        "[\u5f31]": "2009426204112537.gif",
        "[\u63e1\u624b]": "2009426203539512.gif",
        "[\u80dc\u5229]": "2009426204646794.gif",
        "[\u62b1\u62f3]": "2009426204728451.gif",
        "[\u52fe\u5f15]": "2009426203737612.gif",
        "[\u62f3\u5934]": "2009426203910315.gif",
        "[\u5dee\u52b2]": "200942620367378.gif",
        "[\u7231\u4f60]": "2009426203528732.gif",
        "[NO]": "2009426204721695.gif",
        "[OK]": "200942620396799.gif",
        "[\u7231\u60c5]": "2009426205315887.gif",
        "[\u98de\u543b]": "2009426205314448.gif",
        "[\u8df3\u8df3]": "2009426203559585.gif",
        "[\u53d1\u6296]": "2009426205315218.gif",
        "[\u6004\u706b]": "2009426205315310.gif",
        "[\u8f6c\u5708]": "2009426205315736.gif",
        "[\u78d5\u5934]": "2009426204734202.gif",
        "[\u56de\u5934]": "2009426205315546.gif",
        "[\u8df3\u7ef3]": "2009426205315951.gif",
        "[\u6295\u964d]": "2009426205315383.gif",
        "[\u6fc0\u52a8]": "2009426205315324.gif",
        "[\u4e71\u821e]": "2009426205315991.gif",
        "[\u732e\u543b]": "2009426205315888.gif",
        "[\u5de6\u592a\u6781]": "2009426205315937.gif",
        "[\u53f3\u592a\u6781]": "2009426205315143.gif"
    };
    return function(b, myClass) {
        var d = "/static/home/images/emoji/qq/";
        if(b){
            if(myClass){
                return b.replace(/\/:[^\/]{0,8}/g,
                    function(b) {
                        for (var e = b.length; 2 < e; e--){
                            if (b.substr(0, e) in a)
                                return '<img class="' + myClass + '" src="' + d + a[b.substr(0, e)] + '"/>' + b.substr(e);
                        }
                        return b
                    })
            }else{
                return  b in a && d + a[b]
            }
        }else{
            return {
                emotions: a,
                baseUrl: d
            }
        }

    }
} ()

//输入某个表情key  得到对应的地址
const mb = function() {
    return function(a) {
        var b = ba().emotions,
            u = ba().baseUrl,
            d = Object.keys(b);
        var getImg = function(url){
            return '<img class="emoji" src="'+u+url+'">'
        }
        return a.replace(/\[[NOK\u4E00-\u9FA5\uF900-\uFA2D]{1,3}\]/g,
            function(a) {
                for (var e = a.length; 2 < e; e--) if (a.substr(0, e) in b) {
                    var g = a.substr(0, e),
                        k = d.indexOf(g);
                    return k!=-1 ? getImg(b[g]) : xss(a);
                }
                return xss(a)
            })
    }
} ;

// 返回所有表情
const drawEmoji = function (){
    //如果没渲染图片
        var a = ba(),
            c = a.baseUrl,
            a = a.emotions,
            e;
            let list = []
        for (e in a) {
            list.push({
                k:e,
                url:c+a[e]
            })
        }
        return list
}

export default drawEmoji